home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / games / dcgames4.zip / DCSCRREF.DOC < prev    next >
Text File  |  1995-10-02  |  68KB  |  2,898 lines

  1. Introduction     1 
  2.  
  3. Abs     3 
  4.  
  5. Action     3 
  6.  
  7. Adjustments     4 
  8.  
  9. Button     5 
  10.  
  11. Continue     5 
  12.  
  13. Copy     6 
  14.  
  15. Dec     7 
  16.  
  17. DefCaveBlk     7 
  18.  
  19. DefLandBlk     8 
  20.  
  21. DefSpookBlk     8 
  22.  
  23. DefWaterBlk     9 
  24.  
  25. DefStat     9 
  26.  
  27. DefPack     10 
  28.  
  29. Display     11 
  30.  
  31. DoText     13 
  32.  
  33. Drop     14 
  34.  
  35. Edit_Player     15 
  36.  
  37. EndGame     16 
  38.  
  39. Enter     16 
  40.  
  41. Failure     16 
  42.  
  43. Fight     17 
  44.  
  45. Fighting     17 
  46.  
  47. Find     18 
  48.  
  49. For     19 
  50.  
  51. Foreach     20 
  52.  
  53. Frame     21 
  54.  
  55. GetAction     22 
  56.  
  57. GetNum     23 
  58.  
  59. GetStr     24 
  60.  
  61. Goto     25 
  62.  
  63. Gosub     26 
  64.  
  65. If     27 
  66.  
  67. Inc     28 
  68.  
  69. Join     28 
  70.  
  71. Leave     29 
  72.  
  73. LoadHint     29 
  74.  
  75. LoadText     30 
  76.  
  77. Locate     30 
  78.  
  79. Min, Max     31 
  80.  
  81. Move     32 
  82.  
  83. Music     33 
  84.  
  85. On x Goto, On x Gosub     34 
  86.  
  87. Paint     35 
  88.  
  89. Pause     35 
  90.  
  91. Random     36 
  92.  
  93. ReadText     37 
  94.  
  95. Restart     38 
  96.  
  97. Restore     39 
  98.  
  99. Return     39 
  100.  
  101. Save     40 
  102.  
  103. SavePCX     40 
  104.  
  105. Select     41 
  106.  
  107. SetBody     43 
  108.  
  109. SetBp     44 
  110.  
  111. Sgn     45 
  112.  
  113. SOUND     45 
  114.  
  115. Stats     46 
  116.  
  117. Stop     47 
  118.  
  119. Success     47 
  120.  
  121. System     48 
  122.  
  123. Teleport     49 
  124.  
  125. Vanish     50 
  126.  
  127. Version     51 
  128.  
  129. ViewFLI     52 
  130.  
  131. ViewPCX     53 
  132.  
  133. Voice     54 
  134.  
  135. VPlay     55 
  136.  
  137. Wait     55 
  138.  
  139. While     56 
  140.  
  141. Write[ln]     57 
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161. D C  -  G A M E S 
  162.  
  163.  
  164.  
  165.  
  166.  
  167. Version 4.0
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175. SCRIPT LANGUAGE REFERENCE GUIDE
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201. (c) DC Software, 1989-1995
  202.  
  203. 7908 Kettlewood Court
  204.  
  205. Plano Tx 75025
  206.  
  207. (214) 491-1579 Introduction
  208.  
  209. Purpose
  210.  
  211. This manual presents all of the language commands and functions
  212. in alphabetical order and using a consistent presentation for
  213. all of them.  It is not intended to teach you how to write a
  214. script, but rather to describe in detail each and every command
  215. and function in the language.
  216.  
  217. The Script Language User's Guide is a more general document that
  218. tries to teach you how to write scripts.  That manual talks
  219. about the different types of scripts, the reasons for writing
  220. them, etc.  The examples in it include many different commands,
  221. since they try to show how to do something rather than teach you
  222. how many different things you can do with a single command.
  223.  
  224. The best way to use these manuals is to read the User's Guide
  225. from begining to end, and consult the Reference Guide only when
  226. you want to know more about a particular command or function.
  227.  
  228. If you are comfortable with programming languages, you can
  229. probably read this manual from side to side and end up knowing a
  230. lot about the script language itself, but you will not find out
  231. here the how, when or why of writing scripts.
  232.  
  233. Sincerely,
  234.  
  235.  
  236.  
  237. David A. Hernandez Abs
  238.  
  239. Syntax    ret-val = abs( expr );
  240.  
  241. Purpose    Returns the absolute value of the numeric expression.
  242.  
  243. Parameters    expr
  244.  
  245. Is an arithmetic expression.
  246.  
  247. Returns    The absolute value (positive number) of the expression.
  248.  
  249. Remarks    The absolute value of a number is the same number, but
  250. always with a positive sign.  Thus, abs(-2) and abs(2) are both
  251. 2.
  252.  
  253. Example    ! Check to see if there is a great disparity between the
  254. character's 
  255.  
  256. ! experience and the npc's experience.
  257.  
  258. if abs( player.exp - npc.exp ) > 3 then
  259.  
  260.     writeln( "Perhaps another time.." );
  261.  
  262. else
  263.  
  264.     join; ! NPC joins the party..
  265.  
  266. endif;
  267.  
  268. See Also    min, max, sign
  269.  
  270. Action
  271.  
  272. Syntax    ret-val = action;
  273.  
  274. Purpose    Find out what action invoked the script.
  275.  
  276. Returns    The numeric action code which is actually the number of
  277. the entry point at which execution of the script will begin. 
  278. See Entry Points in the User's Guide for more information on
  279. these values.
  280.  
  281. Example    ! The following code handles both LOOK and EXAMINE, but
  282. EXAMINE
  283.  
  284. ! prints more detail than LOOK.
  285.  
  286. :LOOKING
  287.  
  288.     writeln("You see a ", object.name, ".  Type ", object.type );
  289.  
  290.     if action = EXAMINE then
  291.  
  292.         writeln( ", Class ", object.class, ", Weight: ", object.weight
  293. );
  294.  
  295.     endif;
  296.  
  297.     ...
  298.  
  299. Adjustments
  300.  
  301. Syntax    ret-val = adjustments( expr1, ... );
  302.  
  303. Purpose    Compute the adjustments to character attributes
  304. indicated by the given set of values.
  305.  
  306. Parameters    expr1, ...
  307.  
  308. Is one or more expressions separated by comma that result each
  309. in a number between 0 and 255.
  310.  
  311. Returns    The sum of the adjustments computed for each value
  312. independently.
  313.  
  314. Remarks    The adjustment is computed using the values in the
  315. [ATTRIBUTE MODIFIERS] section of the DCCTOKEN.DAT file. The
  316. default  values are:
  317.  
  318.     Value Range         Effect 
  319.  
  320. 0     8     Decrease by -1 point 
  321.  
  322. 9     15     No change 
  323.  
  324. 16     18     Increase by 1 point 
  325.  
  326. 19     20     Increase by 2 points 
  327.  
  328. 21     30     Increase by 3 points 
  329.  
  330. 31     40     Increase by 4 points (and so on..) 
  331.  
  332.  
  333.  
  334.     During regular game play, a character's class determines such
  335. factors as the weight it can carry, the type of weapons and/or
  336. armor it can use, it's ability to strike moving targets, etc.
  337.  
  338.     In addition to the character class, it's standard attributes
  339. (such as strength, aim, dexterity, iq, etc.) may increase or
  340. decrease these factors.  For example, the stronger a character
  341. is, the more weight it can carry.
  342.  
  343. Example    ! An ELF has a 1 in 4 chance to detect a trap, adjusted
  344. by it's dexterity and
  345.  
  346. ! intelligence.  All others have a 1 in 2 chance adjusted by
  347. dexterity.
  348.  
  349. if player.type = ELF then
  350.  
  351.     L28 = 4 + adjustments( player.dex, player.iq );
  352.  
  353. else
  354.  
  355.     L28 = 2 + adjustments( player.dex );
  356.  
  357. endif;
  358.  
  359. if random(L28) = 0 then ... trap activated ... else ... trap
  360. found ... endif;
  361.  
  362. Button
  363.  
  364. Syntax    retval =  button;
  365.  
  366. Purpose    Find out which mouse button was pressed.
  367.  
  368. Remarks    When a mouse event is sent to the CONTROL script, the
  369. button function tells you which button was pressed. 1 = Right
  370. Button, 2 = Left Button, 3 = Middle Button.
  371.  
  372. See Also    keypress, pointx, pointy
  373.  
  374. Continue
  375.  
  376. Syntax    continue;
  377.  
  378. Purpose    Terminate execution of the current script.
  379.  
  380. Remarks    This command informs the game driver that while the
  381. script has performed some actions, the DEFAULT action should
  382. still be taken, if any.
  383.  
  384. Warning    Because the OBJECT script contains the default action
  385. for objects, that script should never end with a continue. 
  386. Doing so would indicate that default action is needed, which may
  387. result in the object script being run twice for the same action.
  388.  
  389. See Also    stop, fight
  390.  
  391. Copy
  392.  
  393. Syntax    copy( source, destination [, count] );
  394.  
  395. Purpose    To create a copy of an object and place it in a given
  396. location.
  397.  
  398. Parameters    source
  399.  
  400. The copy command can copy an object from curritem, object,
  401. group.vehicle, npc.bp, npc.body, npc.weapon, npc.armor,
  402. npc.shield, npc.ring, npc.amulet, npc.staff, player.bp,
  403. player.body, player.weapon, player.armor, player.shield,
  404. player.ring, player.amulet and player.staff.
  405.  
  406.     destination
  407.  
  408. The destination can be any of the above, except for the generic
  409. locations curritem and object.
  410.  
  411.     count
  412.  
  413. This is the number of copies of the object that are placed at
  414. the destination.  It is an expression that results in a value
  415. between 1 and 255.  If omited, the default is the number of
  416. copies in the source.
  417.  
  418. Remarks    The destination must be appropriate to the type of
  419. object, for example, you can't move an object of type amulet to
  420. player.shield.
  421.  
  422.     When an object is copied or moved to the generic destination
  423. .body, it will be placed in the correct body section according
  424. to the object's type.
  425.  
  426.     When the count is greater than one, copies are moved one by
  427. one.  The character's load is checked before each move to verify
  428. that the character can carry the object.  If the character's
  429. maximum load is reached before all objects have been copied, the
  430. failure variable is set to the actual number of copies moved.
  431.  
  432. Examples    ! Copy 5 instances of an object from npc.bp to player.bp
  433.  
  434. copy( npc.bp, player.bp, 5 );
  435.  
  436. if failure then
  437.  
  438.   L6 = failure;
  439.  
  440.   writeln( player.name, " could only carry ", L6 );
  441.  
  442.   drop( npc.bp, - L6 ); ! Place the rest on the floor.. !
  443.  
  444. endif;
  445.  
  446. See Also    move, failure, drop
  447.  
  448. Dec
  449.  
  450. Syntax    dec( variable [, expr]  )
  451.  
  452. Parameters    variable    is any numeric variable or attribute that
  453. can be modified from within a script.
  454.  
  455.     expr
  456.  
  457. is an optional expression that results in a number that will be
  458. substracted from the variable.  If omited, the default is 1.
  459.  
  460. Remarks    The decrement command will substract the amount
  461. indicated (1 if none is given) from the variable or attribute
  462. specified.  If the expression is negative, then the double
  463. substraction results in an addition.
  464.  
  465. Example    ! An NPC strikes the player
  466.  
  467. dec( player.hp, npc.weapon.damage );
  468.  
  469. DefCaveBlk
  470.  
  471. Syntax    ret-val = DefCaveBlk( which );
  472.  
  473. Purpose    Returns a graphics block number for cave and dungeon
  474. monsters. (Class CAVE_MONSTER)
  475.  
  476. Parameters    which
  477.  
  478. Identifies which of the five graphics blocks for random monsters
  479. you want.  The value must be between 0 and 4, with 0 being the
  480. smallest monster and 4 being the toughest.
  481.  
  482. Returns    ret-val
  483.  
  484. Is a graphics block record number (between 0 and 255) to be used
  485. for random monsters that are found in caves or dungeons.
  486.  
  487. Remarks    The DCWORLD parameter configuration screen is used to
  488. set the graphics blocks that will be used to generate random
  489. monsters.
  490.  
  491. See Also    DefLandBlk, DefWaterBlk, DefSpookBlk, DefStat, DefPack
  492.  
  493. DefLandBlk
  494.  
  495. Syntax    ret-val = DefLandBlk( which );
  496.  
  497. Purpose    Returns a graphics block number for outdoor, land based
  498. monsters. (Class LAND_MONSTER).
  499.  
  500. Parameters    which
  501.  
  502. Identifies which of the five graphics blocks for random monsters
  503. you want.  The value must be between 0 and 4, with 0 being the
  504. smallest monster and 4 being the toughest.
  505.  
  506. Returns    ret-val
  507.  
  508. Is a graphics block record number (between 0 and 255) to be used
  509. for random monsters that are land based.
  510.  
  511. Remarks    The DCWORLD parameter configuration screen is used to
  512. set the graphics blocks that will be used to generate random
  513. monsters.
  514.  
  515. See Also    DefCaveBlk, DefWaterBlk, DefSpookBlk, DefStat, DefPack
  516.  
  517. DefSpookBlk
  518.  
  519. Syntax    ret-val = DefSpookBlk( which );
  520.  
  521. Purpose    Returns a graphics block number for monsters that you
  522. might find in places like hounted houses or cementeries (Class
  523. SPOOK_MONSTER).
  524.  
  525. Parameters    which
  526.  
  527. Identifies which of the five graphics blocks for random monsters
  528. you want.  The value must be between 0 and 4, with 0 being the
  529. smallest monster and 4 being the toughest.
  530.  
  531. Returns    ret-val
  532.  
  533. Is a graphics block record number (between 0 and 255) to be used
  534. for random monsters of this type..
  535.  
  536. Remarks    The DCWORLD parameter configuration screen is used to
  537. set the graphics blocks that will be used to generate random
  538. monsters.
  539.  
  540. See Also    DefLandBlk, DefCaveBlk, DefWaterBlk, DefStat, DefPack
  541.  
  542. DefWaterBlk
  543.  
  544. Syntax    ret-val = DefWaterBlk( which );
  545.  
  546. Purpose    Returns a graphics block number for aquatic monsters
  547. (monsters that swim, class WATER_MONSTER).
  548.  
  549. Parameters    which
  550.  
  551. Identifies which of the five graphics blocks for random monsters
  552. you want.  The value must be between 0 and 4, with 0 being the
  553. smallest monster and 3 being the toughest.  Number 4 is used to
  554. represent a Pirate's Ship, which requires special handling to
  555. make sure a pirate's ship doesn't appear on a small pond of
  556. water in the middle of town!
  557.  
  558. Returns    ret-val
  559.  
  560. Is a graphics block record number (between 0 and 255) to be used
  561. for random monsters that are land based.
  562.  
  563. Remarks    The DCWORLD parameter configuration screen is used to
  564. set the graphics blocks that will be used to generate random
  565. monsters.
  566.  
  567. See Also    DefLandBlk, DefCaveBlk, DefSpookBlk, DefStat, DefPack
  568.  
  569. DefStat
  570.  
  571. Syntax    ret-val = DefStat( which );
  572.  
  573. Purpose    Returns an index into the statistics file (PLAYER.DTA)
  574. which holds the statistics that will be used for small, medium,
  575. large and pirate monsters.
  576.  
  577. Parameters    which
  578.  
  579. Is the size of the character you are creating.  0=Small,
  580. 1=Medium and 2=Large, 3=Pirates.
  581.  
  582. Returns    ret-val
  583.  
  584. Is the statistics record number (npc.stats) which holds the
  585. generic statistics for the size of character you indicated.
  586.  
  587. Remarks    The DCWORLD parameter configuration screen is used to
  588. set the 4 values that will be used as statistics records for
  589. random monsters.
  590.  
  591. See Also    DefLandBlk, DefCaveBlk, DefSpookBlk, DefPack
  592.  
  593. DefPack
  594.  
  595. Syntax    ret-val = DefPack( which );
  596.  
  597. Purpose    Returns an index into the statistics file (PLAYER.DTA)
  598. which holds the statistics record whose backpack contains the
  599. items that will be used to generate random treasure.
  600.  
  601. Parameters    which
  602.  
  603. Is which of the 3 backpacks should be used (0, 1 or 2).
  604.  
  605. Returns    ret-val
  606.  
  607. Is the statistics record number (npc.stats) whose backpack
  608. contains items to be used for random treasure.
  609.  
  610. Remarks    The DCWORLD parameter configuration screen is used to
  611. select the statistics records to be used.  The statistics screen
  612. is used to modify the records themselves.  The default records
  613. contain Potions, Rings & Amulets, and Magic Staffs respectively.
  614.  
  615. See Also    DefLandBlk, DefCaveBlk, DefSpookBlk, DefStat
  616.  
  617.  
  618.  
  619. Display
  620.  
  621. Syntax    display ( group );1
  622.  
  623. display [$[2]] ( {player|npc}  [, {matching|type}] );2
  624.  
  625. display [$[2]] ( {player.body|npc.body} );3
  626.  
  627. display [$] (  string [, value] [, string ... ] );4
  628.  
  629. Purpose    Display a list of characters, items, etc, on the menu
  630. area.
  631.  
  632. Parameters    group, player, npc, player.body and npc.body
  633.  
  634. Identify what you want to display in the menu area.
  635.  
  636.     matching
  637.  
  638. Used to indicate that only items that match the items of the
  639. type carried by the current npc should be displayed.  (Used by
  640. merchants)
  641.  
  642.     type    
  643.  
  644. is a number between 0 and 255 (tokens may be used). 
  645.  
  646.     string
  647.  
  648. is a text string enclosed in quotes.
  649.  
  650.     value
  651.  
  652. is either a number (constant or token) or a single variable or
  653. attribute whose value is numeric.  No arithmetic expressions are
  654. permited.
  655.  
  656. Remarks    The display command is a powerful tool to display a list
  657. of values in the menu area of the screen.  If a $ is specified,
  658. then values will be displayed as gold or silver pieces (1gp =
  659. 10sp).  The 2 following the $ 
  660.  
  661. indicates that the values should be divided by 2 before being
  662. displayed.
  663.  
  664.  
  665.  
  666. 1) Displays the current members of the playing party
  667.  
  668. 2) Displays the contents of a character's backpack. If matching
  669. is specified, it indicates that only items that match the types
  670. of items in the current npc's  backpack should be displayed. If
  671. type is provided, only items of the specified type are displayed.
  672.  
  673. 3) Displays the set of items being worn by a character (weapon,
  674. armor, shield, amulet, ring and staff).
  675.  
  676. 4) Displays a list of strings with or without values associated
  677. with it.
  678.  
  679. Examples    ! Display the current members
  680.  
  681. display( group );
  682.  
  683.  
  684.  
  685. ! Display the current player's inventory
  686.  
  687. display( player );
  688.  
  689.  
  690.  
  691. ! Display a merchant's inventory (with prices)
  692.  
  693. display$( npc );
  694.  
  695.  
  696.  
  697. ! Display the player's items that the merchant might want to
  698. buy..
  699.  
  700. display$2( player, matching );
  701.  
  702.  
  703.  
  704. ! Display a list of items and a price (numbers in silver pieces)
  705.  
  706. display$( "Magic Ring", 300, "Short Sword", 150, "Banana", 1 );
  707.  
  708.  
  709.  
  710. ! Display a list with numbers (not $)
  711.  
  712. display( "Age", 27, "Strength", npc.str, "Max Weight",
  713. npc.mload);
  714.  
  715. See Also    select
  716.  
  717. DoText
  718.  
  719. Syntax    ret-val = dotext( str-val );
  720.  
  721. Purpose    To perform keyword analysis compatible with pervious
  722. prior versions of the DCGAMES system.
  723.  
  724. Parameters    str-val
  725.  
  726. Is either a word surrounded by double quotes (string constant),
  727. or the string variable S0.
  728.  
  729. Returns    ret-val
  730.  
  731. Returns the index of the keyword in the text record (1-16) if
  732. found, 0 if not found.
  733.  
  734. Remarks    This compares the keyword str-val against the first 8
  735. characters of the string variables S1 through S16.  If a match
  736. is found, then the text found in the variable that had the
  737. matching keyword (minus the keyword) is displayed on the screen
  738. and the number (1-16) of the string that had the match is
  739. returned.  Otherwise, a 0 is returned and no message is
  740. displayed.
  741.  
  742.     If a SoundBlaster card is present, and the current character or
  743. object being processed has a voice file associated with it
  744. (voice attribute), then the voice file (VOICE###.VFL, where ###
  745. is the value of the voice attribute), is searched for the same
  746. keyword, and if present, the corresponding recorded voice is
  747. played.
  748.  
  749.     If the voice file is not present or the keyword is not found in
  750. the voice file, but the SBTALKER text-to-speach translator is
  751. present (memory resident), then the text that followed the
  752. keyword will be spoken in addition to being displayed.    
  753.  
  754. Example    ! Talk to the player..
  755.  
  756. :TALKHERE
  757.  
  758. L9 = getstr( "Hello", "King", "Queen", "Treasure", "Key", "Door"
  759. );
  760.  
  761. if NOT dotext( s0 ) then   ! The text record didn't handle the
  762. keyword..
  763.  
  764.     on L9 gosub XHELLO, XKING, XQUEEN, XGOLD, XKEY, XDOOR;
  765.  
  766. endif;
  767.  
  768. if S0 <> "Bye" goto TALKHERE;
  769.  
  770. stop;
  771.  
  772. See Also    voice, vplay, write, writeln
  773.  
  774. Drop
  775.  
  776. Syntax    drop( item [, howmany [, x [, y]]]  );
  777.  
  778. Purpose    Get rid of an item that a character is carrying or
  779. riding.
  780.  
  781. Parameters    item
  782.  
  783. Is the item to be dropped, which must be one of: group.vehicle,
  784. curritem, player.bp, player.body, player.weapon, player.armor,
  785. player.shield, player.ring, player.amulet, player.staff, npc.bp,
  786. npc.body, etc.
  787.  
  788.     howmany
  789.  
  790. Is the number of items to be dropped.  0 means all. A negative
  791. means that the objects are not to be removed, but rather
  792. duplicated. The default value is 1.
  793.  
  794.     x, y
  795.  
  796. Is the location in the world where the object will be placed. 
  797. The default values are the current player's location.
  798.  
  799. Remarks    The item will be added to the world's list of objects
  800. with a count attribute as indicated by the howmany parameter.
  801.  
  802.     If the howmany parameter is 0, the current count attribute of
  803. the item being dropped is used.
  804.  
  805.     If the howmany parameter is negative,  it indicates that a copy
  806. should be made of the items.  The originals are left intact.
  807.  
  808.     If the absolute value of the howmany parameter is greater than
  809. the count attribute of the item, then howmany is used.  (i.e.,
  810. you end up with more copies than you had!).
  811.  
  812. Examples    ! The following are all equivalent
  813.  
  814. drop( curritem );    ! If the current item is the current backpack
  815. item
  816.  
  817. drop( player.bp );
  818.  
  819. drop( player.bp, 1 );
  820.  
  821. drop( player.bp, 1, player.x, player.y );
  822.  
  823.  
  824.  
  825. ! If the npc has a weapon, drop it one square to the right of
  826. the player
  827.  
  828. if npc.weapon.count then
  829.  
  830.   drop( npc.weapon, npc.count, player.x+1, player.y );
  831.  
  832. endif;
  833.  
  834. Edit_Player
  835.  
  836. Syntax    edit_player( which [, points, min, max, [flags, ...]]  );
  837.  
  838. Purpose    Allow access to the player editing screen from the
  839. scripts.
  840.  
  841. Parameters    which
  842.  
  843. Indicates which party member is to be edited.  The value is in
  844. the range 1 to 6.
  845.  
  846.     points
  847.  
  848. You may specify the number of points that the player may
  849. allocate to the different attributes.  Default is 25.
  850.  
  851.     min
  852.  
  853. The player may not set any attribute below this threshold.
  854. Default 9.
  855.  
  856.     max
  857.  
  858. The player may not set any attribute above this threshold.
  859. Default 20.
  860.  
  861.     flags
  862.  
  863. Edit flags. A 1  allows editing of that field, a 0 does not.
  864. Default is 1. The list of flags is shown in the example.
  865.  
  866. Remarks    Usually called from the INITGAME script during game
  867. initialization to allow the player to configure his/her
  868. character.  See that script for an extended example.
  869.  
  870. Example    ! Allow player to customize his character within the
  871. limits:
  872.  
  873. setplayer(1);
  874.  
  875. player.class = ELF;  ! Fixed class
  876.  
  877. player.mstr = 12;      ! Fix Strength
  878.  
  879. edit_player( 1,    ! Main Character
  880.  
  881.     25,        ! Distribute 30 points
  882.  
  883.     8,        ! Don't allow a value lower than 8
  884.  
  885.     25,        ! Don;t allow a value higher than 25
  886.  
  887.     1,        ! Allow edit "NAME"
  888.  
  889.     0,        ! Don't allow edit of character class
  890.  
  891.     1,        ! Allow player to select a tile (graphics block)
  892.  
  893.     0        ! Don't allow edit of the first attribute (Strength)
  894.  
  895.     );        ! Allow edit of all other attributes
  896.  
  897.     
  898.  
  899. EndGame
  900.  
  901. Syntax    endgame;
  902.  
  903. Purpose    Terminate the game.  You have either won or lost, but
  904. you cannot continue.
  905.  
  906. Remarks    The game displays the copyright screen and returns the
  907. user to DOS.  The assumption is that an appropriate ending
  908. scenario has been executed by the script.
  909.  
  910. Enter
  911.  
  912. Syntax    enter( door# );
  913.  
  914. Purpose    Send the playing party through a specific door, wherever
  915. it might lead.
  916.  
  917. Parameters    door#
  918.  
  919. A numeric expression that indicates which door should in the
  920. current world you want to take.
  921.  
  922. Remarks    The transfer through the door does not take place until
  923. after the script ends execution. You still need to use the stop
  924. or continue option to end the script.
  925.  
  926. Failure
  927.  
  928. Syntax    ret-val = failure;
  929.  
  930. Purpose    To find out if the last major operation failed.
  931.  
  932. Returns    ret-val
  933.  
  934. The returns will be non-zero (TRUE) if the last major operation
  935. failed to complete successfuly.
  936.  
  937. Example    ! A merchant sells an item to a player..
  938.  
  939. writeln( "Here is your ", npc.bp.name );
  940.  
  941. copy( npc.bp, player.bp );
  942.  
  943. if failure then
  944.  
  945.     writeln( "The ", npc.bp.name, " is placed on the floor.." );
  946.  
  947.     drop( npc.bp );
  948.  
  949. endif;
  950.  
  951. See Also     success
  952.  
  953. Fight
  954.  
  955. Syntax    fight;
  956.  
  957. Purpose    Go into fighting mode against the currently selected npc
  958. character.
  959.  
  960. Remarks    The type of the npc does not have to be HOSTILE. The
  961. fight may be against any character of any type.
  962.  
  963.     The script is immediatly ended and the fight starts right away.
  964.  No stop or continue command is needed.
  965.  
  966. Warning    Do not use fight after you have done enter.  The fight
  967. takes place before the transfer is made, but the scripts that
  968. execute during and immediately after the fight may get confused.
  969.  The desired behaviour for this situation is yet to be
  970. determined..
  971.  
  972. See Also    fighting
  973.  
  974. Fighting
  975.  
  976. Syntax    ret-val = fighting;
  977.  
  978. Purpose    To find out if the script is executing during a fight.
  979.  
  980. Returns    ret-val
  981.  
  982. A non-zero value (TRUE) is returned when a fight is taking place.
  983.  
  984. Remarks    Your script may behave differently depending on whether
  985. you are in a fight or not.  For example, certain spells may not
  986. work during a fight.
  987.  
  988.     During a fight, the party and the npc are separated into their
  989. respective individuals, and all other characters are removed
  990. from the screen.
  991.  
  992.     The party may not leave the area during a fight, but pressing
  993. the ESC key will exit fighting mode and allow the party to
  994. attempt to out-run the enemy.
  995.  
  996. See Also    fight
  997.  
  998. Find
  999.  
  1000. Syntax    retval = find( where [, what [, type]] );
  1001.  
  1002. Purpose    Find an object or character.
  1003.  
  1004. Parameters    where
  1005.  
  1006. Identifies where you want to search for the object.  It can be
  1007. one of group, object, npc, player, npc.bp, player.bp, npc.body
  1008. or player.body.
  1009.  
  1010.     what
  1011.  
  1012. Is the name of the item or person you are looking for.  It must
  1013. either be a string constant ("like this") or a string attribute
  1014. of a character or object.
  1015.  
  1016.     type
  1017.  
  1018. If present, it indicates that the item must not only have the
  1019. given name, but must also have the given type attribute.  The
  1020. value is either a numeric constant, a numeric token or the type
  1021. attribute of a character or object.
  1022.  
  1023. Returns    The index attribute of the item (starts with 0), or
  1024. negative if the item was not found.
  1025.  
  1026. Remarks    When group is searched, what is a character name, and
  1027. success indicates that the character is a member of the group.
  1028.  
  1029.     When object is searched, the current world is searched for an
  1030. object with the given name (and type, if given).
  1031.  
  1032.     When npc is searched, the current world is searched for an
  1033. object with the given name (and type, if given).
  1034.  
  1035.     When player is given, the backpacks of every player in the
  1036. current group is searched for the given object.  The value
  1037. returned is the index of the player carrying the object, not the
  1038. index of the object in the backpack.
  1039.  
  1040.     When npc.bp or player.bp is specified, the backpack of the
  1041. character is searched for the given object.
  1042.  
  1043.     When npc.body or player.body is specified, the items currently
  1044. worn by the character are searched (weapon, armor, shield, ring,
  1045. amulet and staff).
  1046.  
  1047. For
  1048.  
  1049. Syntax    for localvar = expr1 to expr2 [by value] do statements;
  1050. endfor;
  1051.  
  1052. Purpose    Execute a set of statements a given number of times.
  1053.  
  1054. Parameters    localvar
  1055.  
  1056. Is a local variable which will be used to hold the loop's
  1057. current value.
  1058.  
  1059.     expr1
  1060.  
  1061. Is the initial value that will be assigned to the local variable.
  1062.  
  1063.     expr2
  1064.  
  1065. Is an expression against which the local variable is compared to
  1066. determine if the statements should be executed or if the loop
  1067. has ended.
  1068.  
  1069.     value
  1070.  
  1071. Is a numeric constant (may be negative) which is added to the
  1072. local variable at the end of every iteration (after the
  1073. statements are executed).
  1074.  
  1075. Remarks    Expr1 is evaluated once, at the begining of the loop,
  1076. but expr2 is evaluated every time after the value has been added
  1077. to localvar. The statements between the do and endfor keywords
  1078. will be executed again and again until local variable's value
  1079. becomes greater (or less if the value is negative) than expr2.
  1080.  
  1081. Examples    ! Search the npc's backpack for an object (could use
  1082. find instead!).
  1083.  
  1084. for L0 = 0 to 15 do
  1085.  
  1086.     setbp( npc, L0 );
  1087.  
  1088.     if npc.bp.count > 0 and npc.bp.name = "The Thing" then
  1089.  
  1090.        writeln( "I found it!" );
  1091.  
  1092.     endif;
  1093.  
  1094. endfor;
  1095.  
  1096. if L0 = 16 then writeln( "Didn't find it!" ); endif;
  1097.  
  1098. See Also    foreach, find
  1099.  
  1100.  
  1101.  
  1102. Foreach
  1103.  
  1104. Syntax    foreach item do statements; endfor;
  1105.  
  1106. Purpose    Allow you to process all players, npcs or objects, in
  1107. order.
  1108.  
  1109. Parameters    item
  1110.  
  1111. Is one of player, npc or object.
  1112.  
  1113. Remarks    If the item is player, then the player variable will be
  1114. set to each of the members of the group, consecutively.
  1115.  
  1116.     If the item is npc,  then the npc variable will be set to every
  1117. character in the current world, consecutively. Warning: when you
  1118. are fighting, the list of npcs refers to the monsters you are
  1119. fighting. Other npcs are not available.
  1120.  
  1121.     If the item is object, then the object variable will be set to
  1122. each of the objects in the current world, consecutively.
  1123.  
  1124. Examples    ! Drop the weapons carried by every member of the group
  1125.  
  1126. foreach player do
  1127.  
  1128.    if player.weapon.count then
  1129.  
  1130.         drop( player.weapon );
  1131.  
  1132.    endif;
  1133.  
  1134. endif;
  1135.  
  1136.     ! Check to see if there is a character named 'Morris' in this
  1137. world.
  1138.  
  1139. ! (Could have used the find command)
  1140.  
  1141. foreach npc do
  1142.  
  1143.     if npc.name = "Morris" then
  1144.  
  1145.        writeln( "Found Him!" );
  1146.  
  1147.     endif;
  1148.  
  1149. endfor;
  1150.  
  1151.     ! Find out if there is any object at a specific location in the
  1152. world
  1153.  
  1154. foreach object do
  1155.  
  1156.     if object.x = 30 and object.y = 23 then
  1157.  
  1158.         writeln("Object ", object.name, " is on the hot spot.."
  1159. );
  1160.  
  1161.     endif;
  1162.  
  1163. endfor;
  1164.  
  1165. Frame
  1166.  
  1167. Syntax    frame( x, y, block# );
  1168.  
  1169. Purpose    Display a system graphics block over the current
  1170. graphics block at the x and y location within the current world.
  1171.  
  1172. Parameters    x
  1173.  
  1174. Is the horizontal position for the frame.  May be an expression.
  1175.  
  1176.     y
  1177.  
  1178. Is the vertical position for the frame. May be an expression.
  1179.  
  1180.     block#
  1181.  
  1182. Is the graphics block record number from the system graphics
  1183. file which contains the frame you wish to display.
  1184.  
  1185. Remarks    If the x, y position is not on the screen, the frame is
  1186. not shown.
  1187.  
  1188.     The frame is X-ORed (over-imposed) on top of the graphics at
  1189. the given location.  To remove the frame, you re-display the
  1190. frame at the same location.
  1191.  
  1192. Example    ! Draw a SPLAT type frame on top of the group to
  1193. indicate they have
  1194.  
  1195. ! been hit by something (i.e. the members suffered some damage)
  1196.  
  1197. frame( group.x, group.y, SYS_SPLAT );
  1198.  
  1199. wait(1);
  1200.  
  1201. frame( group.x, group.y, SYS_SPLAT );
  1202.  
  1203.     ! Draw a bullet being shot from the current player to an npc.
  1204.  
  1205. ! (This algorithm doesn't really work very well.  It is just an
  1206. example)
  1207.  
  1208. if player.x < npc.x then L0 = 1; else L0 = -1; endif;
  1209.  
  1210. if player.y < npc.y then L1 = 1; else L1 = -1; endif;
  1211.  
  1212. for L3 = player.x to npc.x by L0 do
  1213.  
  1214.     for L4 = player.y to npc.y by L1 do
  1215.  
  1216.         frame( L3, L4, SYS_BULLET );
  1217.  
  1218.         wait(1);
  1219.  
  1220.         frame(L3, L4, SYS_BULLET );
  1221.  
  1222.     endfor;
  1223.  
  1224. endfor;
  1225.  
  1226. GetAction
  1227.  
  1228. Syntax    retval = getaction;
  1229.  
  1230. Purpose    Allows the player to point with the mouse cursor and
  1231. click at something, or to type a character on the keyboard.
  1232.  
  1233. Returns    retval
  1234.  
  1235. Contains the value of the key pressed or mouse event. In the
  1236. control script, the keypress variable contains the current
  1237. action, so see that script to figure out how to interpret the
  1238. retval information.
  1239.  
  1240. See Also    keypress, pointx, pointy, button
  1241.  
  1242. GetNum
  1243.  
  1244. Syntax    retval = getnum( string [, low [, high] ] );
  1245.  
  1246. Purpose    This function displays a message and asks the user to
  1247. enter a numeric value between low and high inclusive.  The value
  1248. that the user types is returned as the function's value.
  1249.  
  1250. Parameters    string
  1251.  
  1252. Is a string to be displayed in the text area of the game screen,
  1253. before the user is asked to enter a number.
  1254.  
  1255.     low
  1256.  
  1257. Is the minimum allowed value.  It may be an expression.  The
  1258. default is 0.
  1259.  
  1260.     high
  1261.  
  1262. Is the maximum allowed value.  It may be an expression. The
  1263. default value is 32767.
  1264.  
  1265. Returns    This function returns a number between low and high as
  1266. typed by the game player, or -1 if the game player pressed the
  1267. ESCape key.
  1268.  
  1269. Remarks    The low value is returned if you press the ENTER key.
  1270.  
  1271.     The value -1 is returned if you press the ESC (escape) key.
  1272.  
  1273. Example    ! Drop some (or all) of a certain object
  1274.  
  1275. L6 = getnum( "Drop how many", 0, player.bp.count );
  1276.  
  1277. if L6 > 0 then
  1278.  
  1279.     drop( player.bp.count, L6 );
  1280.  
  1281. endif;
  1282.  
  1283.  
  1284.  
  1285. GetStr
  1286.  
  1287. Syntax    retval = getstr( "string" ,... );
  1288.  
  1289. Purpose    Asks the user to type in something (a word), then
  1290. compares the keyword entered with the list of strings and
  1291. returns the numeric index of the string that matches (if any).
  1292.  
  1293. Parameters    "string ",...
  1294.  
  1295. Is a list of up to 255 keywords.
  1296.  
  1297. Returns    The getstr command will compare the keyword typed by the
  1298. player to the list of words provided as parameters and return
  1299. the position of the word in the list (if found).
  1300.  
  1301. Remarks    You can list up to 255 strings may be listed.
  1302.  
  1303.     Only the first 8 characters of the string are compared.
  1304.  
  1305.     The comparison is case insensitive (i.e. "Hello" is equal to
  1306. "HELLO").
  1307.  
  1308.     If you press the ESCape key, the value returned is -1.
  1309.  
  1310.     If the word is not found, the value returned is -2 and the word
  1311. is left in the string variable s0.
  1312.  
  1313. Examples    ! Everyone died, so...
  1314.  
  1315. writeln( "What do you want to do (Restore, Restart, Quit)" );
  1316.  
  1317. L3 = getstr( "Restore", "Restart", "Quit");
  1318.  
  1319. on L3 goto :my_restore, :my_restart, :my_quit;
  1320.  
  1321. if L3 = -2 then writeln( "I don't know what you mean by ", s0 );
  1322.  
  1323. stop;
  1324.  
  1325.     :my_quit
  1326.  
  1327.     endgame;
  1328.  
  1329.     :my_restore
  1330.  
  1331.     ...
  1332.  
  1333.     :my_restart
  1334.  
  1335.     ...
  1336.  
  1337. See Also     select, on x goto
  1338.  
  1339. Goto
  1340.  
  1341. Syntax    goto LABEL;
  1342.  
  1343. Purpose    Within the script, transfer the execution to the
  1344. indicated label.
  1345.  
  1346. Remarks    The LABEL must be defined elsewhere in the script as
  1347. follows
  1348.  
  1349.         :LABEL
  1350.  
  1351.     Execution of the script continues on the first statement after
  1352. the indicated label.
  1353.  
  1354. Example    ! Transfer execution 
  1355.  
  1356. goto SKIP;
  1357.  
  1358. writeln( "You should NOT see this line" );
  1359.  
  1360.     :SKIP
  1361.  
  1362. writeln( "You should see this one instead" );
  1363.  
  1364. See Also    on x goto, if expr goto, gosub, on x gosub and if expr
  1365. gosub
  1366.  
  1367. Gosub
  1368.  
  1369. Syntax    gosub LABEL;
  1370.  
  1371. Purpose    Within the script, transfer the execution to the
  1372. indicated label.
  1373.  
  1374. Remarks    The LABEL must be defined elsewhere in the script as
  1375. follows
  1376.  
  1377.         :LABEL
  1378.  
  1379.     Execution of the script continues on the first statement after
  1380. the indicated label.
  1381.  
  1382.     When the return statement is found, execution returns to the
  1383. first statement after the gosub statement.
  1384.  
  1385.     This statement is used to perform a series of statements at
  1386. many different points within the same script.
  1387.  
  1388. Example    ! Transfer execution 
  1389.  
  1390. gosub SKIP;
  1391.  
  1392. writeln( "You should see this message SECOND" );
  1393.  
  1394. stop;
  1395.  
  1396.  
  1397.  
  1398. :SKIP
  1399.  
  1400. writeln( "You should see this message FIRST!" );
  1401.  
  1402. return;
  1403.  
  1404. writeln( "You should NOT see this message at all" );
  1405.  
  1406. See Also    return, on x gosub and if expr gosub
  1407.  
  1408. If
  1409.  
  1410. Syntax    if expr1 then statements1;
  1411.  
  1412. [elsif expr2 then statements2; ...]
  1413.  
  1414. [else statements3;]
  1415.  
  1416. endif;
  1417.  
  1418.     or
  1419.  
  1420.     if expr1 goto label;
  1421.  
  1422.     or
  1423.  
  1424.     if expr1 gosub label;
  1425.  
  1426. Purpose    Execute a group of statements only if the expresion expr
  1427. is true.
  1428.  
  1429. Parameters    expr1, expr2, ...
  1430.  
  1431. These are logical expressions which evaluate to a True or False
  1432. value.  True is any non-zero value.  False is zero.
  1433.  
  1434.     statements1, statements2, ...
  1435.  
  1436. These are the statements to be executed the related expression
  1437. is true.
  1438.  
  1439.     statments3
  1440.  
  1441. These are the statements to be executed if NONE of the given
  1442. expressions are true (i.e. they are all false).
  1443.  
  1444. Remarks    In the second and third form, the goto or gosub are
  1445. executed only if the expression expr1 evaluates to a non-zero
  1446. value.
  1447.  
  1448. Examples    ! Drop the current player's weapon
  1449.  
  1450. if player.weapon.count > 0 then
  1451.  
  1452.     drop( player.weapon );
  1453.  
  1454. else
  1455.  
  1456.     writeln( "You are not wielding a weapon" );
  1457.  
  1458. endif;
  1459.  
  1460. Inc
  1461.  
  1462. Syntax    inc( variable [, expr]  )
  1463.  
  1464. Parameters    variable    is any numeric variable or attribute that
  1465. can be modified from within a script.
  1466.  
  1467.     expr
  1468.  
  1469. is an optional expression that results in a number that will be
  1470. added to the variable.  If omited, the default is 1.
  1471.  
  1472. Remarks    The increment command will add the amount indicated (1
  1473. if none is given) to the variable or attribute specified.  If
  1474. the expression is negative, the effect will be to decrement the
  1475. value.
  1476.  
  1477. Example    ! An player drinked some healing potion, so restore some
  1478. points..
  1479.  
  1480. inc( player.hp, curritem.units );
  1481.  
  1482. Join
  1483.  
  1484. Syntax    join;
  1485.  
  1486. Purpose    Cause the npc character to join the current party.
  1487.  
  1488. Remarks    The current npc is removed from the world in which it
  1489. exists and added to the player's party.
  1490.  
  1491.     The npc variable is cleared (i.e. no npc is selected any
  1492. longer).
  1493.  
  1494.     The party can hold a maximum of 6 players. If the party is
  1495. full, the npc will NOT join the party.
  1496.  
  1497. Leave
  1498.  
  1499. Syntax    leave( whom );
  1500.  
  1501. Purpose    Cause a player to leave the party.
  1502.  
  1503. Remarks    The player with index whom in the group will leave the
  1504. party.
  1505.  
  1506.     Note that the main player (index 0 is not allowed to leave the
  1507. party.
  1508.  
  1509.     Note also that the player's script is NOT invoked to give it a
  1510. chance to refuse to leave.  This is in contrast to the game
  1511. driver's V)acate command (player pressed letter V), which
  1512. invokes the player's script, and if the script either does not
  1513. handle the action, or terminates with continue, then invokes the
  1514. CONTROL script which in turn executes the a leave command.
  1515.  
  1516. Example    ! When the party enters the King's Castle, if the king
  1517. is a member of the
  1518.  
  1519. ! party it means that the King has been rescued and now should
  1520. leave the
  1521.  
  1522. ! party and go sit with the queen..
  1523.  
  1524. if world.name = "King's Castle" then
  1525.  
  1526.    L0 = find( group, "The King" );
  1527.  
  1528.    if L0 > 0 then                                   ! Found the
  1529. king
  1530.  
  1531.        writeln( "The king leaves you and heads for the throne
  1532. room.." );
  1533.  
  1534.        L1 = find( npc, "The Queen" );   ! Find out where the
  1535. Queen is
  1536.  
  1537.        npc.index = L1;                           ! Select her as
  1538. current npc.
  1539.  
  1540.        leave( L0, npc.x+1, npc.y );        ! Place the king next
  1541. to the queen. 
  1542.  
  1543.    endif;
  1544.  
  1545. endif;
  1546.  
  1547. LoadHint
  1548.  
  1549. Syntax    loadhint;
  1550.  
  1551. Purpose    Load a one-line 'hint' from the hint file (HINT.DTA).
  1552.  
  1553. Remarks    Hints are placed in the HINT.DTA file using the DCWORLD
  1554. game builder.
  1555.  
  1556.     The hint is selected at random and placed in variable S0.
  1557.  
  1558. Example    ! Display a hint
  1559.  
  1560. loadhint;
  1561.  
  1562. writeln( "The beggar gives you a hint:", S0 );
  1563.  
  1564. LoadText
  1565.  
  1566. Syntax    loadtext( text-record-# );
  1567.  
  1568. Purpose    To load a text record (16 lines of text) from the
  1569. TEXT.DTA file into the 16 string variables S1 through S16.
  1570.  
  1571. Remarks    The text-record-# is an expression that evaluates to a
  1572. number between 0 and the number of text records in the TEXT.DTA
  1573. file (minus one).
  1574.  
  1575.     The given record is loaded into the S1 through S16 (not S0).
  1576.  
  1577. See Also    dotext
  1578.  
  1579. Locate
  1580.  
  1581. Syntax    ret-val = locate [ ( object | npc [, x, y  ] ) ] ;
  1582.  
  1583. Purpose    If no X,Y is given, the player is asked to point on the
  1584. screen using the keyboard or the mouse. If an object or npc is
  1585. found at that location, it becomes the current object or npc
  1586. respectively.
  1587.  
  1588. Returns    ret-val
  1589.  
  1590. The distance from the object or npc found (largest of x or y
  1591. distance).
  1592.  
  1593. Remarks    If the first parameter is omited, the player is allowed
  1594. to point to either an object or a character.  If it is given,
  1595. then the player must point to an object or an npc depending on
  1596. the parameter that was specified.
  1597.  
  1598.     When you specify the X/Y location, that location is verified
  1599. immediatly, and the user is NOT asked to point at all. See the
  1600. code in the CONTROL script for handling movement and checking
  1601. for guards!.
  1602.  
  1603. Examples    ! Attack someone
  1604.  
  1605. writeln( "Attack who?" );
  1606.  
  1607. L2 = locate(npc);
  1608.  
  1609. if L2 < 0 then stop; ! No one
  1610.  
  1611. if L2 > 2 then  writeln( "You must get closer.." );
  1612.  
  1613. ! goto attack_code;
  1614.  
  1615.     ! Check before you move to the right..
  1616.  
  1617. if locate(npc,player.x + 1, player.y) then
  1618.  
  1619.   writeln( "Can't go there!" );..
  1620.  
  1621. Min, Max
  1622.  
  1623. Syntax    ret-val = min( expr  [, expr ...] );  or
  1624.  
  1625. ret-val = max( expr [, expr ...] );
  1626.  
  1627. Purpose    To obtain the smallest (or largest) of a set of values.
  1628.  
  1629. Parameters    expr
  1630.  
  1631. Two or more arithmetic expressions separated by commas.  A
  1632. maximum of 255 expressions are allowed.
  1633.  
  1634. Examples    ! Look for the object with the highest weight in the
  1635. player's backpack
  1636.  
  1637. L0 = -1;
  1638.  
  1639. foreach player.bp do
  1640.  
  1641.     L0 = max( L0, player.bp.weight );
  1642.  
  1643. endfor;
  1644.  
  1645. if L0 > 0 then
  1646.  
  1647.   writeln( "The heavyest object has a weight of  ", L0, "lbs" );
  1648.  
  1649. endif;
  1650.  
  1651. Move
  1652.  
  1653. Syntax    move( source, destination [, count] );
  1654.  
  1655. Purpose    To create a copy of an object and place it in a given
  1656. location.
  1657.  
  1658. Parameters    source
  1659.  
  1660. The move command can move an object from curritem, object,
  1661. group.vehicle, npc.bp, npc.body, npc.weapon, npc.armor,
  1662. npc.shield, npc.ring, npc.amulet, npc.staff, player.bp,
  1663. player.body, player.weapon, player.armor, player.shield,
  1664. player.ring, player.amulet and player.staff.
  1665.  
  1666.     destination
  1667.  
  1668. The destination can be any of the above, except for the generic
  1669. locations curritem and object.
  1670.  
  1671.     count
  1672.  
  1673. This is the number of copies of the object to be moved.  It must
  1674. be a value between 1 and the actual number of copies (.count
  1675. attribute).
  1676.  
  1677. Remarks    The destination must be appropriate to the type of
  1678. object, for example, you can't move an object of type amulet to
  1679. player.shield.
  1680.  
  1681.     When an object is copied or moved to the generic destination
  1682. .body, it will be placed in the correct body section according
  1683. to the object's type.
  1684.  
  1685.     If there is no space to put the object in the destination, the
  1686. operation fails, and the number of objects that were actually
  1687. moved is stored in the failure variable.
  1688.  
  1689.       The backpack can hold 16 items.  Each body part can hold only
  1690. one item.
  1691.  
  1692. See Also    copy, drop, vanish, failure
  1693.  
  1694. Music
  1695.  
  1696. Syntax    music( filename | stop );
  1697.  
  1698. Purpose    Starts playing a CMF music
  1699.  
  1700. Parameters    filename
  1701.  
  1702. The name of the music file. May include a DOS path and be up to
  1703. 64 chars in length.
  1704.  
  1705.     stop
  1706.  
  1707. If you use the stop keyword instead of a file name, any music
  1708. currently playing is stopped.
  1709.  
  1710. Remarks    The filename must be a string constant (surrounded by
  1711. double quotes).
  1712.  
  1713.     You must have a Sound Blaster compatible card to play music. If
  1714. none is present the command is ignored.
  1715.  
  1716. Examples    ! Play some music and wait until either the music ends, 
  1717.  
  1718. ! the player presses a key or 2 minutes have elapsed.
  1719.  
  1720. music( "Intro.cmf" );
  1721.  
  1722. wait( 180 );
  1723.  
  1724.     ! Play some music in the background, display a picture and then 
  1725.  
  1726. ! Wait for 2 minutes or until the player presses a key, even if
  1727. the 
  1728.  
  1729. ! music ends.
  1730.  
  1731. music( "c:/game/sound/mymusic.cmf");
  1732.  
  1733. pause( 180 );
  1734.  
  1735.     ! Play some music while talking to a character..
  1736.  
  1737. music( "healer.cmf" );
  1738.  
  1739. ... do stuff here ...
  1740.  
  1741. :XSTOP
  1742.  
  1743.     writeln( "Y'all come back, now!" );
  1744.  
  1745.     music( stop );
  1746.  
  1747.     stop;
  1748.  
  1749. See Also    wait, pause
  1750.  
  1751. On x Goto, On x Gosub
  1752.  
  1753. Syntax    on expr {goto|gosub} label0, label1, label2, ... labeln;
  1754.  
  1755. Purpose    To support the transfer of control to one of a set of
  1756. labels depending on the value of an expression.
  1757.  
  1758. Parameters    expr
  1759.  
  1760. This expression evaluates to a number between 0 and n.
  1761.  
  1762.     label0, label1, ..
  1763.  
  1764. These are the labels that have been declared elsewhere in the
  1765. script to receive control of execution.
  1766.  
  1767. Remarks    The difference between goto and gosub is that the return
  1768. statement will return execution to the statement following the
  1769. on statement..
  1770.  
  1771.     If the expression has a negative value or a value greater than
  1772. n, no transfer takes place, and execution continues on the
  1773. statement following the on statement.
  1774.  
  1775. Example    ! Talk to the player..
  1776.  
  1777. :TALKHERE
  1778.  
  1779. L9 = getstr( "Hello", "King", "Queen", "Treasure", "Key", "Door"
  1780. );
  1781.  
  1782. loadtext( player.text );
  1783.  
  1784. if NOT dotext( s0 ) then   ! The text record didn't handle the
  1785. keyword..
  1786.  
  1787.     on L9 gosub XHELLO, XKING, XQUEEN, XGOLD, XKEY, XDOOR;
  1788.  
  1789. endif;
  1790.  
  1791. if S0 <> "Bye" goto TALKHERE;
  1792.  
  1793. stop;
  1794.  
  1795. See Also     goto, gosub, if x goto, if x gosub, return
  1796.  
  1797. Paint
  1798.  
  1799. Syntax    paint( { screen | window } );
  1800.  
  1801. Purpose    To re-paint either the entire screen or just the game
  1802. playing window because the script has performed some actions
  1803. that have probably erased all or part of the window.
  1804.  
  1805. Remarks    This statement is useful when you move the player of the
  1806. screen by modifying it's x and y attributes.
  1807.  
  1808.     It is also a good idea after running a DOS program, or after
  1809. you display a PCX graphics file on the screen.
  1810.  
  1811. See Also    viewpcx
  1812.  
  1813. Pause
  1814.  
  1815. Syntax    pause( time );
  1816.  
  1817. Purpose    Pauses script execution until the user presses the space
  1818. key or the specified time has elapsed.
  1819.  
  1820. Parameters    time
  1821.  
  1822. This parameter is optional.  It specifies a limit on the time
  1823. that the command will wait.  (In seconds).  Any numeric
  1824. expression that results in a number between 0 and 32000 seconds.
  1825.  A value of 0 means that no time limit is present.  The user
  1826. MUST press a key to continue. Note that pause(0); can also be
  1827. written pause;.
  1828.  
  1829. Remarks    Used to wait for the user to read something on the
  1830. screen or to see a graphics file that is being displayed, 
  1831.  
  1832. Examples    ! Display a character's picture, then wait for 2
  1833. minutes or until the
  1834.  
  1835. ! player presses a key
  1836.  
  1837. if player.picture > 0 then
  1838.  
  1839.    viewpcx( player );
  1840.  
  1841.    pause(120);
  1842.  
  1843.    paint(screen);
  1844.  
  1845. endif;
  1846.  
  1847. See Also    wait
  1848.  
  1849. Random
  1850.  
  1851. Syntax    ret-val = random( expr );
  1852.  
  1853. Purpose    Return a random number between 0 and expr-1.
  1854.  
  1855. Parameters    expr
  1856.  
  1857. Is an arithmetic expression that results in a positive number
  1858. larger than 1.
  1859.  
  1860. Returns    ret-val
  1861.  
  1862. Is a value between 0 and expr-1.
  1863.  
  1864. Remarks    The expr is value is the number of alternatives you want
  1865. to consider.
  1866.  
  1867. Example    ! 3 out of every 10 times, write a message
  1868.  
  1869. if random( 10 ) < 3 then ! 0,1 and 2
  1870.  
  1871.    writeln( "We have a winner!" );
  1872.  
  1873. endif;
  1874.  
  1875.     ! generate a monster of random size
  1876.  
  1877. on random(5) gosub XTINY, XSMALL, XMEDIUM, XLARGE, XHUGE;
  1878.  
  1879. ...
  1880.  
  1881.     ! Once out of every 7 times..
  1882.  
  1883. if random(7) = 0 then ! or 1 or 2 or .. 6, but just one of them !
  1884.  
  1885.     gosub DOSOMETHING;
  1886.  
  1887. endif;
  1888.  
  1889. ReadText
  1890.  
  1891. Syntax    readtext( block# [, line#] );    or
  1892.  
  1893. readtext( "filename" );
  1894.  
  1895. Purpose    To read and display some text on the screen
  1896.  
  1897. Parameters    block#
  1898.  
  1899. Is the record number from the TEXT.DTA file.
  1900.  
  1901.     line#
  1902.  
  1903. Is the line number within the block (1 to 16) or 0 (default)
  1904. which means that the entire text record should be displayed.
  1905.  
  1906.     filename
  1907.  
  1908. Is the name of a text file to be read and displayed.
  1909.  
  1910. Remarks    If block# is given, the record is read into variables S1
  1911. through S16.
  1912.  
  1913.     If line# is non zero, only that line is displayed.
  1914.  
  1915.     The entire lines are displayed, the lines are not expected to
  1916. contain keywords of any kind (unlike dotext)
  1917.  
  1918.     If a filename is provided, the screen is cleared and the text
  1919. is displayed in full screen (but still graphics) mode.  The
  1920. paint command should be used to re-paint the screen after the
  1921. text has been read.  Also, the pause command may be used before
  1922. the paint command to give a chance to the player to read the
  1923. last page.
  1924.  
  1925.     The text file may contain some control commands that start with
  1926. the % sign as follows:
  1927.  
  1928.     %MUSIC musicfile.cmf
  1929.  
  1930. Plays the CMF format file musicfile in the background (The
  1931. SoundBlaster SBFMDRV.COM must be memory resident).
  1932.  
  1933.     %VIEWPCX pcxfile.pcx
  1934.  
  1935. Show the PCX graphics file on the screen in the resolution and
  1936. with the pallete closest to the one specified in the PCX file
  1937. that is available in the computer.
  1938.  
  1939.     %VPLAY vocfile.voc
  1940.  
  1941. Plays the VOC format file on the foreground if a SoundBlaster
  1942. card is present.
  1943.  
  1944.     %READ textfile
  1945.  
  1946. The DOS text file is read through the SoundBlaster
  1947. text-to-speach driver (SBTALKER) if installed.
  1948.  
  1949.     %PAGE
  1950.  
  1951. Say "press <SPACE> to continue" and clear the screen when the
  1952. player does press the space bar.
  1953.  
  1954.     %WAIT time
  1955.  
  1956. Wait a maximum of time seconds or until all music and/or voice
  1957. has finished playing.  If the time expires before the music or
  1958. voice is over, the music or voice is stopped.  Also, if the user
  1959. presses SPACE while waiting, the voice and music are stoped and
  1960. the wait expires.
  1961.  
  1962. Restart
  1963.  
  1964. Syntax    restart;
  1965.  
  1966. Purpose    Restart the game from the begining, but does not re-run
  1967. the introduction or cause the player to have to re-create
  1968. his/her character.
  1969.  
  1970. Remarks    From the DOS prompt, you can re-start the game by typing:
  1971.  
  1972.         C:\games> del sav*.*
  1973.  
  1974.     If you also want to re-create the playing party, type also:
  1975.  
  1976.         C:\games> del party.dta
  1977.  
  1978. Restore
  1979.  
  1980. Syntax    restore( slot# );
  1981.  
  1982. Purpose    Restores the game to a previously saved possition.
  1983.  
  1984. Parameters    slot#
  1985.  
  1986. The # of the saved game, which may be in the range 1 through 999.
  1987.  
  1988. Remarks    The restore command works by first deleting all files
  1989. with name SAV*.000 from the current directory, and then copying
  1990. all files of name SAV*.### (the saved game) to files names
  1991. SAV*.000.
  1992.  
  1993.     The current game is held in slot # 0.  Every time you transfer
  1994. from one world to another, the current game is saved to slot 0. 
  1995. This means that if your game is interrupted for any reason (for
  1996. example, you accidentaly press Ctrl-Alt-Del), your game state is
  1997. restored to the time at which you entered the current world.
  1998.  
  1999. See Also    save, restart
  2000.  
  2001. Return
  2002.  
  2003. Syntax    return;
  2004.  
  2005. Purpose    Returns execution control to the instruction following
  2006. the last gosub that was executed.
  2007.  
  2008. Remarks    To write a subroutine, you declare a label (which will
  2009. be used by the gosub statement to invoke it), followed by some
  2010. script statements, followed by the return statement.
  2011.  
  2012. Example    ! Subroutine to move one step to the right.
  2013.  
  2014. MOVERIGHT:
  2015.  
  2016. if group.x < world.x-1 and world.density <= VERY_ROUGH then
  2017.  
  2018.     inc(group.x);
  2019.  
  2020. endif;
  2021.  
  2022. return;
  2023.  
  2024. Save
  2025.  
  2026. Syntax    save( slot# );
  2027.  
  2028. Purpose    Saves the current game in the given slot.
  2029.  
  2030. Parameters    slot#
  2031.  
  2032. The slot to be used to save the game.  May be in the range 1
  2033. through 999.
  2034.  
  2035. Remarks    The save command works by first saving to slot 0 and
  2036. then copying all files with name SAV*.000 to files of name
  2037. SAV*.###.
  2038.  
  2039.     The current game is held in slot # 0.  Every time you transfer
  2040. from one world to another, the current game is saved to slot 0. 
  2041. This means that if your game is interrupted for any reason (for
  2042. example, you accidentaly press Ctrl-Alt-Del), your game state is
  2043. restored to the time at which you last entered the current world.
  2044.  
  2045. See Also    restore, restart
  2046.  
  2047. SavePCX
  2048.  
  2049. Syntax    savepcx( "fname.pcx" );
  2050.  
  2051. Purpose    Saves the screen as a PCX format graphics file to the
  2052. given filename.
  2053.  
  2054. Parameters    "fname.pcx"
  2055.  
  2056. A string constant containing a valid DOS filename.
  2057.  
  2058. Remarks    The system does not check to make sure the filename is a
  2059. valid DOS filename, nor does it add the .PCX extension if it is
  2060. not provided.
  2061.  
  2062.     If the file already exists, it is overwritten.
  2063.  
  2064. Example    ! Save the current screen
  2065.  
  2066. savepcx( "scrndump.pcx" ); 
  2067.  
  2068. See Also    viewpcx
  2069.  
  2070. Select
  2071.  
  2072. Syntax    retval = select ( group );1
  2073.  
  2074. retval = select [$[2]] ( {player|npc}  [, {matching|type}] );2
  2075.  
  2076. retval = select [$[2]] ( {player.body|npc.body} );3
  2077.  
  2078. retval = select [$] (  string [, value] [, string ... ] );4
  2079.  
  2080. Purpose    Display a list of characters, items, etc, on the menu
  2081. area, and then allow the player to select one of the displayed
  2082. items. The item selected becomes the current generic item of the
  2083. appropriate type.
  2084.  
  2085. Parameters    group, player, npc, player.body and npc.body
  2086.  
  2087. Tells the select command what you want to select from.
  2088.  
  2089.     matching
  2090.  
  2091. Used to indicate that only items that match the items of the
  2092. type carried by the current npc should be displayed.
  2093.  
  2094.     type
  2095.  
  2096. is a number or token with a value between 0 and 255.
  2097.  
  2098.     string
  2099.  
  2100. is a text string enclosed in quotes.
  2101.  
  2102.     value
  2103.  
  2104. is either a number (constant or token) or a single variable or
  2105. attribute whose value is numeric.  No arithmetic expressions are
  2106. permited.
  2107.  
  2108. Returns    The number that returns is the index to the selected
  2109. item.  
  2110.  
  2111. Remarks    If a $ is specified, then values will be displayed as
  2112. gold or silver pieces (1gp = 10sp).  The 2 following the $
  2113. indicates that the values should be divided by 2 before being
  2114. displayed.
  2115.  
  2116.  
  2117.  
  2118. 1) Select a member of the playing party.  The selected member
  2119. (if any) becomes the current player.
  2120.  
  2121.  
  2122.  
  2123. 2) Select one of the items in the character's backpack. If
  2124. matching is specified, only items that match the type of items
  2125. in the current npc's backpack will be displayed. If type is
  2126. provided, only items of the specified type are displayed.  The
  2127. selected item becomes the character's current .bp item.
  2128.  
  2129.  
  2130.  
  2131. 3) Select one of the items being worn by the current character.
  2132. The item selected becomes the current player.body item.  If the
  2133. character is not wearing any items (weapon, armor, shield, ring,
  2134. amulet or staff), no menu is displayed and the function return a
  2135. -1.
  2136.  
  2137.  
  2138.  
  2139. 4) Displays a menu with the options listed (strings), and allows
  2140. the player to select one of them. It returns the index to the
  2141. selected one.  The first item is 0.
  2142.  
  2143.     If no item is selected (player pressed <ESC> key) the function
  2144. returns -1.
  2145.  
  2146.     If the list is empty (no item is being carried in the backpack
  2147. or being worn), the function also returns -1.
  2148.  
  2149. Examples    ! Select the current spokes-person...
  2150.  
  2151. L3 = select( group );
  2152.  
  2153.     ! Show list of potions being carried and give it to the npc
  2154.  
  2155. L8 = display( player, POTION );
  2156.  
  2157. If L8 >= 0 then 
  2158.  
  2159.   move( player.bp, npc );
  2160.  
  2161. endif;
  2162.  
  2163.     ! A merchant offers to sell something.
  2164.  
  2165. L39 = select$( npc );
  2166.  
  2167. if L39 >= 0 then
  2168.  
  2169.     if group.gold >= npc.bp.value then
  2170.  
  2171.         writeln( "Sold ", npc.bp.count, " ", npc.bp.name );
  2172.  
  2173.         copy( npc.bp, player );
  2174.  
  2175.         if failure then
  2176.  
  2177.             writeln( "I'll just put it here on the floor.." );
  2178.  
  2179.             drop( npc.bp );
  2180.  
  2181.         endif;
  2182.  
  2183.         dec( group.gold, npc.bp.value );
  2184.  
  2185.     else
  2186.  
  2187.         writeln( "You don't have enough money!" );
  2188.  
  2189.     endif;
  2190.  
  2191. else
  2192.  
  2193.     writeln( "Ok.." );
  2194.  
  2195. endif;
  2196.  
  2197.     ! Display the player's items that the merchant might want to
  2198. buy.
  2199.  
  2200. L39 = select$2( player, matching );
  2201.  
  2202. if L39 >= 0 then
  2203.  
  2204.     writleln( "Here is ", $player.bp.value," for your
  2205. ",player.bp.name);
  2206.  
  2207.     inc( group.gold, player.bp.value / 2 );
  2208.  
  2209.     move( player.bp, npc );
  2210.  
  2211. endif;
  2212.  
  2213.     ! Give the player a choice and take the appropriate action..
  2214.  
  2215. :XAGAIN
  2216.  
  2217. on select("Yes", "No","Maybe") goto XYES, XNO, XMAYBE;
  2218.  
  2219. goto XNONE;
  2220.  
  2221. :XYES
  2222.  
  2223.     writeln( "Good stuff..." );
  2224.  
  2225.     goto SOMEWHERE;
  2226.  
  2227. :XNO
  2228.  
  2229.     writeln("Too bad..." );
  2230.  
  2231.     goto SOMEWHERE;
  2232.  
  2233. :MAYBE
  2234.  
  2235.     writeln( "Will you make up your mind?" );
  2236.  
  2237.     goto XAGAIN;
  2238.  
  2239. :SOMEWHERE
  2240.  
  2241.     ! Now do something else..
  2242.  
  2243. See Also    display
  2244.  
  2245. SetBody
  2246.  
  2247. Syntax    setbody( which, type );
  2248.  
  2249. Purpose    Select the worn item represented by the generic variable
  2250. player.body or npc.body.
  2251.  
  2252. Parameters    which
  2253.  
  2254. Is one of the npc or player attributes .body, .weapon, .armor,
  2255. .shield, .ring, .amulet or .staff.
  2256.  
  2257.     type
  2258.  
  2259. Is an expression that evaluates to one of the six relevant types
  2260. (represented by tokens WEAPON, ARMOR, SHIELD, RING, AMULET or
  2261. STAFF).  Any other value is invalid.
  2262.  
  2263. Remarks    When specifying npc.body or player.body, the type is
  2264. required.
  2265.  
  2266.     When specifying npc.weapon, npc.armor, etc, the type is
  2267. invalid, since it is implied by the attribute itself.
  2268.  
  2269. SetBp
  2270.  
  2271. Syntax    setbp( which, expr );
  2272.  
  2273. Purpose    Select the backpack item represented by the generic
  2274. variable player.bp or npc.bp.
  2275.  
  2276. Parameters    which
  2277.  
  2278. Is one of npc.bp or player.bp, to identify which backpack you
  2279. want to set.
  2280.  
  2281.     expr
  2282.  
  2283. Is an expression resulting in a number between 0 and 15, which
  2284. indicates the position within the backpack that is to be
  2285. represented by the generic variable.
  2286.  
  2287. Remarks    The backpack position may be empty (i.e. not contain a
  2288. valid item).
  2289.  
  2290.     You can tell if an item is present by testing the count
  2291. attribute.  A value of zero always implies that the item does
  2292. not exist.
  2293.  
  2294. Sgn
  2295.  
  2296. Syntax    ret-val = sgn( expr  );
  2297.  
  2298. Purpose    To determine whether an expression is negative, positive
  2299. or zero.
  2300.  
  2301. Parameters    expr
  2302.  
  2303. A single expression whose numeric value may be negative,
  2304. positive or exactly zero.
  2305.  
  2306. Returns    Returns -1 (minus one) if the expression is negative, +1
  2307. (plus one) if the expression is positive and 0 (zero) if the
  2308. expression is exactly zero.
  2309.  
  2310. Remarks    This function may be useful when it is not important to
  2311. know the magnitude of the difference between two values, but
  2312. just whether one of them is greater than the other.
  2313.  
  2314. Examples    ! The character is about to hit the npc.  The npc has a
  2315. 1 in 4 chance of
  2316.  
  2317. ! blocking the attack (25%), but it may be modified to 1 in 3 if
  2318. the npc has
  2319.  
  2320. ! a higher dexterity than the player, or to 1 in 5 if the player
  2321. has the better
  2322.  
  2323. ! dexterity.
  2324.  
  2325. L7 = 4 + sgn( player.dex - npc.dex );
  2326.  
  2327.     ! Another version of the above computes an adjustment based on
  2328. the
  2329.  
  2330. ! player's AND npc's dexterity using the adjustments function,
  2331. and adds
  2332.  
  2333. ! or substracts the adjustment based on who is better.  This
  2334. means that
  2335.  
  2336. ! A high player dexterity OR a low npc dexterity will decrease
  2337. the ability
  2338.  
  2339. ! of the npc to block the attack.
  2340.  
  2341. L7 = 4 + sgn(player.dex-npc.dex) *
  2342. adjustments(player.dex,npc.dex);
  2343.  
  2344. Sound
  2345.  
  2346. Syntax    sound = boolean-value
  2347.  
  2348. if sound then ...
  2349.  
  2350. Purpose    If this variable has a non-zero value, sounds are
  2351. enabled. It is enabled by default, unless you use the -S run
  2352. time argument. You can change the value any time you want to
  2353. enable/disable sound.
  2354.  
  2355. Remarks    If you don't have a sound card, sound can still be
  2356. played through the PC speaker if you convert the voices using
  2357. the VOC2PWM and PACK utility.
  2358.  
  2359. Example    sound = not sound; ! Turn sound on and off    
  2360.  
  2361. Stats
  2362.  
  2363. Syntax    stats; or stats ( [ player|npc, ] who );
  2364.  
  2365. Purpose    Tells the system to display character statistics in the
  2366. menu area, if they are not currently being displayed.
  2367.  
  2368. Parameters    player|npc
  2369.  
  2370. Specifies whether you want to display a player's statistics or
  2371. an NPCs statistics. Note: During a fight, the npcs are the
  2372. monsters you are fighting with. The default is player.
  2373.  
  2374.     who
  2375.  
  2376. Is the index of the player (or npc) whose statistics you want to
  2377. display. If you want to display stats on the current player use
  2378. group.current or player.index (same thing) or use npc.index for
  2379. the current npc.
  2380.  
  2381. Remarks    Statistics are displayed more or less automaticly, but
  2382. during the execution of a script, you can use the menu area for
  2383. other things. If you want to restore the statistics at any time,
  2384. you may use the stats function.
  2385.  
  2386.     If you omit the parameter (stats;), the group summary
  2387. statistics are displayed.
  2388.  
  2389.     If you specify a who of -1, the system will re-display the
  2390. statistics we were already showing.  This is useful when the
  2391. menu area has been used for something else, like the display
  2392. command.
  2393.  
  2394. Example    ! Refresh the statistics area
  2395.  
  2396. stats(-1);
  2397.  
  2398.     ! Display the current player's detailed statistics
  2399.  
  2400. stats( group.current ); Stop
  2401.  
  2402. Syntax    stop;
  2403.  
  2404. Purpose    Terminates execution of the script.
  2405.  
  2406. Remarks    Indicates that the script has performed all required
  2407. actions.
  2408.  
  2409. See Also    continue, fight
  2410.  
  2411. Success
  2412.  
  2413. Syntax    ret-val = success;
  2414.  
  2415. Purpose    To find out if the last major operation was successful.
  2416.  
  2417. Returns    ret-val
  2418.  
  2419. The returns will be non-zero (TRUE) if the last major operation
  2420. completed successfuly.
  2421.  
  2422. Example    ! A merchant sells an item to a player..
  2423.  
  2424. writeln( "Here is your ", npc.bp.name );
  2425.  
  2426. copy( npc.bp, player.bp );
  2427.  
  2428. if success then
  2429.  
  2430.     writeln( "Sold!" );
  2431.  
  2432. else
  2433.  
  2434.     writeln( "The ", npc.bp.name, " is placed on the floor.." );
  2435.  
  2436.     drop( npc.bp );
  2437.  
  2438. endif;
  2439.  
  2440. See Also    failure
  2441.  
  2442. System
  2443.  
  2444. Syntax    system( argument1 [ , argument2 ... ] );
  2445.  
  2446. Purpose    Execute a DOS command.
  2447.  
  2448. Parameters    argumentN
  2449.  
  2450. Is a a string constant, variable or attribute, or a numeric
  2451. constant, token, variable or attribute.  No expressions are
  2452. allowed.
  2453.  
  2454. Remarks    The system command will create a single string by
  2455. concatenating the values of the arguments in very much the same
  2456. way that the writeln command does.  The resulting string is
  2457. assumed to be a DOS command that needs to be executed.
  2458.  
  2459.     If the numeric attributes type or class are displayed, the
  2460. associated string listed in the token file (DCCTOKEN.DAT) is
  2461. used, instead of the numeric value.
  2462.  
  2463.     If a numeric argument is preceeded by a $ sign, the value is
  2464. represented in gold or silver pieces.
  2465.  
  2466.     The failure will be set to the value returned by the DOS
  2467. command.  The value can be tested for non-zero (i.e. just a
  2468. failure) or for it's numeric value, which can have any meaning
  2469. that the DOS command chose to give that value.
  2470.  
  2471. Examples    ! Assuming you have a CASINO game that receives as
  2472. parameters the 
  2473.  
  2474. ! name of the player and the amount of money to start with:
  2475.  
  2476. system( "CASINO ", player.name, " ", group.gold / 10 );
  2477.  
  2478. group.gold = failure * 10; ! Earnings stored in the return value
  2479.  
  2480.     ! The following examples are for save/restore using a DOS
  2481. program..
  2482.  
  2483. save(0);                ! Save current game 
  2484.  
  2485. system(  "MYSAVE SAVE" );    ! Store it somewhere 
  2486.  
  2487. ! or:
  2488.  
  2489. system( "MYSAVE RESTORE" );! Retrieve a saved game to slot 0
  2490.  
  2491. restore(0);                ! Cause the system to re-load slot 0.
  2492.  
  2493. ! or:
  2494.  
  2495. group.current = 0;
  2496.  
  2497. inc( player.v7 );
  2498.  
  2499. save(0);
  2500.  
  2501. system( "pkzip.exe ", player.v7, " SAV*.000 " );
  2502.  
  2503. Teleport
  2504.  
  2505. Syntax    teleport( dest_world [, dest_door] );
  2506.  
  2507. teleport( dest_world, dest_x, dest_y );
  2508.  
  2509. Purpose    When the current script finishes execution, the party
  2510. will be transfered to the given world at the location indicated
  2511. by the given door.
  2512.  
  2513. Parameters    dest_world
  2514.  
  2515. Is the index number of the destination world (0-999)
  2516.  
  2517.     dest_door
  2518.  
  2519. Is the door in the destination world, over which the party will
  2520. be placed.  The default is door 0.
  2521.  
  2522.     dest_x, dest_y
  2523.  
  2524. The coordinates in the destination world at which the party will
  2525. be placed (No door is needed).
  2526.  
  2527. Remarks    Unlike the enter command, no door leading from the
  2528. current world to the destination world is used.  The transfer is
  2529. made directly to the world and location indicated.
  2530.  
  2531. Examples    ! Transfer the party to one of 3 worlds at random
  2532.  
  2533. L3 = random(3);
  2534.  
  2535. if L3 = 0 then
  2536.  
  2537.     teleport( 38 );  ! Teleport to world 38, door 0
  2538.  
  2539. elsif L3 = 1 then
  2540.  
  2541.     teleport( 5, random(2) ); ! Teleport to world 5, door 0 or 1
  2542. (random)
  2543.  
  2544. else
  2545.  
  2546.     teleport( 43, 25, 32 );      ! Teleport to world 43,
  2547. location X=25, Y=32
  2548.  
  2549. endif;
  2550.  
  2551. See Also    enter
  2552.  
  2553. Vanish
  2554.  
  2555. Syntax    vanish( object );
  2556.  
  2557. Purpose    Destroy an object
  2558.  
  2559. Parameters    object
  2560.  
  2561. Is the object to be destroyed. It can be any of the following:
  2562. player.bp, player.body, player.weapon, player.shield,
  2563. player.armor, player.ring, player.amulet, player.staff, npc.bp,
  2564. npc.body, npc.weapon, npc.shield, npc.armor, npc.ring,
  2565. npc.amulet, npc.staff, object, curritem or group.vehicle.
  2566.  
  2567. Remarks    The object is removed and will no longer be available
  2568. anywhere.
  2569.  
  2570.     This is exactly equivalent to setting the count attribute of
  2571. the object to 0, which in effect means that the object is no
  2572. longer there.
  2573.  
  2574. Example    ! 
  2575.  
  2576. ! Destroy a staff after it has no charges left..
  2577.  
  2578. if staff.charges > 1 then
  2579.  
  2580.     dec( staff.charges );
  2581.  
  2582. else
  2583.  
  2584.     writeln( "The ", staff.name, " flashes and disappears.." );
  2585.  
  2586.     vanish( staff );
  2587.  
  2588.     ! Note that staff.count = 0 has the same effect !
  2589.  
  2590. endif;
  2591.  
  2592.    
  2593.  
  2594. See Also    drop, move, copy
  2595.  
  2596. Version
  2597.  
  2598. Syntax    ret-val = version;
  2599.  
  2600. Purpose    Determine the current version of the DCGAMES software
  2601. being used to run the adventure.
  2602.  
  2603. Returns    The version of the game driver in use.
  2604.  
  2605. Remarks    The version number is in the hundreds.  Version 3.00 is
  2606. returned as 300 (three hundred).  Version 3.01 would be returned
  2607. as 301 (three hundred and one). The current version as of August
  2608. 1995 is 4.00 (or 400).
  2609.  
  2610. Example    if version < 400 then
  2611.  
  2612.    writeln( "ACK! You are using an old (incompatibile) driver!!"
  2613. );
  2614.  
  2615.    stop;
  2616.  
  2617. endif;
  2618.  
  2619. ViewFLI
  2620.  
  2621. Syntax    viewfli( "filename.fli" [, framedelay] ); 
  2622.  
  2623. Purpose    Play a FLI (or FLC) animation on the screen
  2624.  
  2625. Parameters    "filename.fli"
  2626.  
  2627. Is a quoted string which contains name of the FLI or FLC file to
  2628. be played. The filename is used exactly as given. (i.e. an
  2629. extension of .FLI or .FLC is NOT automaticly added).
  2630.  
  2631.     framedelay
  2632.  
  2633. Allows you to override the delay between frames when playing
  2634. back the flic.  It is specified in units which occur 18.2 times
  2635. per second, so if you want to delay 2 seconds between each
  2636. frame, the framedelay would be specified as 36 (closest number
  2637. to 36.4). If not specified, the system plays the FLI according
  2638. to the information in the file itself.
  2639.  
  2640. Remarks    This routine only works in 256 color modes. Thus, if you
  2641. are running in VHI resolution (a 16 color mode), the system will
  2642. try to play it in VLO mode.
  2643.  
  2644.     If the movie fits within the world window, it will be played in
  2645. that area.  If it doesn't, but it fits within the screen, the
  2646. screen will be cleared to play it.
  2647.  
  2648.     The system will re-build call PAINT(WINDOW) or PAINT(SCREEN) as
  2649. needed before returning to the script.
  2650.  
  2651. See Also    viewpcx
  2652.  
  2653. ViewPCX
  2654.  
  2655. Syntax    viewpcx( character ); or
  2656.  
  2657. viewpcx( object ); or
  2658.  
  2659. viewpcx( world ); or
  2660.  
  2661. viewpcx( "filename.pcx" );
  2662.  
  2663. Purpose    Display a PCX graphics file on the screen
  2664.  
  2665. Parameters    character
  2666.  
  2667. If you specify player or npc, the characters picture attribute
  2668. will be used to create a filename of the form CPICT###.PCX,
  2669. where ### is the numeric value of the picture attribute.
  2670.  
  2671.     object
  2672.  
  2673. If you specify an object (object, curritem, player.bp, etc..)
  2674. then the object's picture attribute will be used to create a
  2675. filename of the form OPICT###.PCX, where ### is the numeric
  2676. value of the picture attribute.
  2677.  
  2678.     world
  2679.  
  2680. If you specify world, the index attribute of the world (i.e the
  2681. world's number) will be used to create a filename of the form
  2682. WORLD###.PCX, where ### is the world's index value.
  2683.  
  2684.     "filename.pcx"
  2685.  
  2686. Is a quoted string which contains a valid DOS filename. The
  2687. filename is used exactly as given. (i.e. an extension of .PCX is
  2688. NOT automaticly added).
  2689.  
  2690. Remarks    Warning: After the image is displayed, control returns
  2691. to the script leaving the image displayed on the screen. It is
  2692. up to the script writter to decide when the screen should be
  2693. re-freshed by calling the PAINT function.
  2694.  
  2695.     Note also that you can call PAINT(WINDOW) or PAINT(SCREEN)
  2696. depending on whether the image you displayed fits within the
  2697. world view window or whether the whole screen is required.
  2698.  
  2699. See Also    paint
  2700.  
  2701. Voice
  2702.  
  2703. Syntax    voice( "keyword" , rsc );
  2704.  
  2705. Purpose    Play back a voice recording.
  2706.  
  2707. Parameters    keyword
  2708.  
  2709. The keyword is a one 1 to 8 character word that identifies the
  2710. voice recording stored in a voice resource file.
  2711.  
  2712.     rsc
  2713.  
  2714. Is the number of the voice resource file (VOICEnnn.RSC) that
  2715. contains the voice you want to play. The value must be in the
  2716. range 0 to 999 with two exceptions: A value of 1000 indicates
  2717. that the system sounds file DCSOUNDS.RSC should be used; and a
  2718. value of -1 is ignored and no sound is played.  This parameter
  2719. is no longer optional! 
  2720.  
  2721. Remarks    Previous versions of DCGAMES (3.x) would use the
  2722. npc.voice attribute as the default voice, but that is no longer
  2723. supported because you can now do a lot more interaction between
  2724. npcs and players.
  2725.  
  2726.     Since a -1 is allowed and indicates that no sound should be
  2727. played, you don't have to check the npc.voice or player.voice
  2728. attribute when you invoke voice. If none is given, nothing
  2729. happens!
  2730.  
  2731. Examples    ! The character tried to open a chest and it was
  2732. trapped..
  2733.  
  2734. if rand(3) = 0 then ! Trap
  2735.  
  2736.     voice( "Explode", 1000 );  ! System Sound !
  2737.  
  2738.     writeln( "Argh..." );
  2739.  
  2740. endif;
  2741.  
  2742.     ! Talking to a character
  2743.  
  2744. :XTALK
  2745.  
  2746.   L0 = getstr( "Hello", "Bye", "Job", "Name", ... );
  2747.  
  2748.   if L0 >= 0 then 
  2749.  
  2750.      voice( s0, npc.voice );
  2751.  
  2752.      on L0 goto XHELLO, XBYE, XJOB, XNAME,...;
  2753.  
  2754.   endif;
  2755.  
  2756.   writeln( "Beg Pardon?" );
  2757.  
  2758.   goto :XTALK
  2759.  
  2760. See Also    dotext, vplay, music
  2761.  
  2762. VPlay
  2763.  
  2764. Syntax    vplay( "voicefile.voc" );
  2765.  
  2766. Purpose    Play back a voice recording file.
  2767.  
  2768. Parameters    voicefile.voc
  2769.  
  2770. The file voicefile.voc is loaded and played through the
  2771. SoundBlastertm if it is present.
  2772.  
  2773. Remarks    Only the SoundBlaster series of audio cards is supported
  2774. at this time.
  2775.  
  2776.     The file must be stored in the .VOC format, must be shorter
  2777. than 64K and must fit in available memory.
  2778.  
  2779. See Also    dotext, voice, music
  2780.  
  2781. Wait
  2782.  
  2783. Syntax    wait( time );
  2784.  
  2785. Purpose    Wait until all voice and music has finished playing, or
  2786. time seconds have passed.
  2787.  
  2788. Parameters    time
  2789.  
  2790. The maximum number of seconds to wait.  May be in the range 0 to
  2791. 32000.
  2792.  
  2793. Remarks    A time of 0 indicates that there is no time limit.  If
  2794. no music is present, this is equivalent to pause(0); The wait
  2795. ends when either no more voice or music is playing, the user
  2796. pressed the SPACE bar or the specified time has elapsed.
  2797.  
  2798.     If the time limit is reached or the player presses a key, the
  2799. music and voice still playing is stoped.
  2800.  
  2801. Example    ! Play some Background music
  2802.  
  2803. music( "overture.cmf" );    ! Start playing music
  2804.  
  2805. viewpcx( "map.pcx" );    ! Display a picture on the screen
  2806.  
  2807. wait(0);            ! Wait until the music ends or SPACE bar
  2808.  
  2809. paint( SCREEN );        ! re-paint the screen.
  2810.  
  2811. See Also    pause, music, voice, vplay, viewpcx, dotext, paint
  2812.  
  2813. While
  2814.  
  2815. Syntax    while expr do statements; endwhile;
  2816.  
  2817. Purpose    Execute a set of statements as long as the expression is
  2818. non-zero
  2819.  
  2820. Parameters    expr
  2821.  
  2822. Is a logical expression which results in a numeric value.
  2823.  
  2824. Remarks    The expression expr is evaluated and the statements are
  2825. executed until the expression results in a value of zero.
  2826.  
  2827. Examples    ! Ask a question, demand an answer.
  2828.  
  2829. writeln( "Do you agree? (Yes/No)" );
  2830.  
  2831. L3 = getstr( "yes", "no" );
  2832.  
  2833. while L3 < 0 do
  2834.  
  2835.     writeln( "You must say  Yes or No" );
  2836.  
  2837.     L3 = getstr( "yes", "no" );
  2838.  
  2839. endwhile;
  2840.  
  2841. Write[ln]
  2842.  
  2843. Syntax    write( argument [ , argument ... ] );
  2844.  
  2845. writeln[( argument [, argument] )];
  2846.  
  2847. Purpose    Display a line of text on the text area of the screen.
  2848.  
  2849. Parameters    argument
  2850.  
  2851. Is a a string constant, variable or attribute, or a numeric
  2852. constant, token, variable or attribute.  No expressions are
  2853. allowed.
  2854.  
  2855. Remarks    The write command is used to indicate that subsequent
  2856. write or writeln commands will continue writing on the same line
  2857. as this one, unless the line is full.
  2858.  
  2859.     The writeln command indicates that subsequent write or writeln
  2860. commands will start writing on a new line.
  2861.  
  2862.     If the numeric attributes type or class are displayed, the
  2863. associated string listed in the token file (DCCTOKEN.DAT) is
  2864. displayed, instead of the numeric value.
  2865.  
  2866.     If a numeric argument is preceeded by a $ sign, it is displayed
  2867. in gold/silver pieces.
  2868.  
  2869. Examples    ! The following command
  2870.  
  2871. writeln( "Sold ",  L7,  " ", npc.bp.name, " at ", $npc.bp.value
  2872. );
  2873.  
  2874. ! might display
  2875.  
  2876.     Sold 5 Pumkin Pies for 3gp
  2877.  
  2878. ! if npc.bp.name = "Pumkin Pies" and npc.bp.value = 30
  2879.  
  2880.     ! The following command
  2881.  
  2882. write( "You see a ", object.name, " (", object.type, ")" );
  2883.  
  2884. if object.type = WEAPON and object.hands = 2 then
  2885.  
  2886.    writeln( " (Two-Handed) " );
  2887.  
  2888. else
  2889.  
  2890.    writeln; ! End the line..
  2891.  
  2892. endif;
  2893.  
  2894. ! might display
  2895.  
  2896.     You see a Rusty Knife (Weapon)
  2897.  
  2898.